-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link umockdev-record with libumockdev #148
Conversation
Avoid the duplicate static linking of the ioctl sources in umockdev-record, and link it to libumockdev instead. The corresponding symbols are already public in the C API anyway (as they match src/umockdev.map), so just move the previously `internal` classes/methods to `public`. This also avoids confusing complaints about allegedly unused methods. Fixes #138
This can also be seen in https://salsa.debian.org/debian/umockdev/-/blob/master/debian/libumockdev0.symbols , all these supposedly-private symbols are there, like @benzea, WDYT? |
Hmm, I didn't really want to make the path registration public and commit to the API there. Maybe not a big deal to have them as symbols though, as long as they are not documented. |
This drives me nuts.. I tried with the below patch to make this API conditional on compiling the library and umockdev-record: diff --git meson.build meson.build
index ecafcde..215b511 100644
--- meson.build
+++ meson.build
@@ -122,7 +122,7 @@ umockdev_lib = shared_library('umockdev',
'-Wl,--no-undefined',
'-Wl,--version-script,@0@/umockdev.map'.format(srcdir),
],
- vala_args: [ '--vapidir=@0@/src'.format(meson.current_source_dir()) ],
+ vala_args: [ '--define=INTERNAL_REGISTER_API', '--vapidir=@0@/src'.format(meson.current_source_dir()) ],
include_directories: include_directories('src'),
version: lib_version,
install: true,
@@ -173,7 +173,7 @@ umockdev_record_exe = executable('umockdev-record',
'src/debug.c'],
dependencies: [glib, gobject, gio_unix, vapi_posix, vapi_config, vapi_ioctl, libpcap],
link_with: [umockdev_utils_lib],
- vala_args: [ '--vapidir=@0@/src'.format(meson.current_source_dir()) ],
+ vala_args: [ '--define=INTERNAL_REGISTER_API', '--vapidir=@0@/src'.format(meson.current_source_dir()) ],
include_directories: include_directories('src'),
install: true)
diff --git src/umockdev-ioctl.vala src/umockdev-ioctl.vala
index a286faa..2d579e7 100644
--- src/umockdev-ioctl.vala
+++ src/umockdev-ioctl.vala
@@ -741,6 +741,7 @@ public class IoctlBase: GLib.Object {
listeners.remove(devnode);
}
+#if INTERNAL_REGISTER_API
internal void register_path(GLib.MainContext? ctx, string devnode, string sockpath)
{
assert(DirUtils.create_with_parents(Path.get_dirname(sockpath), 0755) == 0);
@@ -782,6 +783,7 @@ public class IoctlBase: GLib.Object {
});
}
}
+#endif // INTERNAL_REGISTER_API
public virtual signal void client_connected(IoctlClient client) {
}
But this doesn't work: If I leave out the
But if I put in the define, it complains, even though umockdev-record clearly calls the API:
|
Oh, stupid me -- of course it really is not being used; umockdev-record only uses |
Avoid the duplicate static linking of the ioctl sources in
umockdev-record, and link it to libumockdev instead. The corresponding
symbols are already public in the C API anyway (as they match
src/umockdev.map), so just move the previously
internal
classes/methods to
public
.This also avoids confusing complaints about allegedly unused methods.
Fixes #138